package org.bbl.db.mybatis.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.List;

/**
 * @author biniamg
 * @since 11/15/12
 */
public interface BaseMapper<T> {
    List<T> findAll();

    T findById(int id);

    T findByIdAndLanguage(int id,int language);

    List<T> findByLanguage(String tableName);

    List<T> findByParentId(int keyId);


    T findByIdentifier(int languageId, String identifier);

    List<T> findMySibling(int languageId, String identifier);

    List<T> findByKeyId(String tableName, int bookId, int chapterId);

    List<T> findByLike(String tableName, int bookIdStart, int bookIdEnd, String key, String key2, RowBounds rowBounds);

    void insert(T t);

    void insertDynamicTable(String param1, T t);

    void delete(int param1);

    @Delete("DELETE FROM ${param1}")
    void truncate(@Param("param1") String param1);

    List<T> findByApproximation(String param1, String param2,
                                int param3, int param4,
                                String param5, String param6,
                                String param7, String param8,
                                RowBounds rowBounds);

    List<T> findLinking(String param1, int param2, int param3, int param4, RowBounds rowBounds);
}
